package com.sms.domain.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.GenericGenerator;

import com.sms.common.BaseEntity;


/**
 * @desc 短信模板
 * @author wjw
 * @time 2017年11月16日下午3:32:01
 */
@Entity
@Table(name = "b_template")
public class Template extends BaseEntity {
    
    private static final long serialVersionUID = -936203994181527906L;
    
    /** 主键id，也是applicationId */
    @Id
    @GeneratedValue(generator = "UIDGenerator")
    @GenericGenerator(name = "UIDGenerator", strategy = "com.sms.common.persistence.UIDGenerator")
    @Column(length = 40)
    private String templateId;
    
    /** 应用ID */
    @ManyToOne(fetch = FetchType.LAZY, optional = true)
    @JoinColumn(name = "app_id")
    private Application application;
    
    /** 模板编码 */
    @NotNull(message = "模板编码不能为空")
    @NotBlank(message = "模板编码不能为空")
    @Column(length = 40)
    private String code;
    
    /** 模板名 */
    @NotNull(message = "模板名不能为空")
    @NotBlank(message = "模板名不能为空")
    @Column(length = 40)
    private String name;
    
    /** 模板内容 */
    @Column(length = 100)
    private String content;
    
    /**
     * 构造函数
     */
    public Template() {
    }
    
    public String getTemplateId() {
        return templateId;
    }
    public void setTemplateId(String templateId) {
        this.templateId = templateId;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }

	public Application getApplication() {
		return application;
	}

	public void setApplication(Application application) {
		this.application = application;
	}
    
}
